/*
 * Copyright (c) 2018. QDU 2015 Java1 Team CompilationError
 */

package team.mai.antexpress.entities;

import javax.persistence.*;
import java.util.Objects;

@Entity
@Table(name = "permission_group", schema = "antexpress", catalog = "")
public class PermissionGroupEntity {
	private int id;
	private String groupName;
	private boolean admin;
	private boolean modifyUser;
	private boolean lookupUser;
	private boolean modifyDepartment;
	private boolean lookupDepartment;
	private boolean modifyDesignation;
	private boolean lookupDesignation;
	private boolean modifyDeliverman;
	private boolean lookupDeliverman;
	private boolean modifyCenter;
	private boolean lookupCenter;
	private boolean useDeliverSystem;

	public PermissionGroupEntity(int id, String groupName, boolean admin, boolean modifyUser, boolean lookupUser, boolean modifyDepartment, boolean lookupDepartment, boolean modifyDesignation, boolean lookupDesignation, boolean modifyDeliverman, boolean lookupDeliverman, boolean modifyCenter, boolean lookupCenter, boolean useDeliverSystem) {
		this.id = id;
		this.groupName = groupName;
		this.admin = admin;
		this.modifyUser = modifyUser;
		this.lookupUser = lookupUser;
		this.modifyDepartment = modifyDepartment;
		this.lookupDepartment = lookupDepartment;
		this.modifyDesignation = modifyDesignation;
		this.lookupDesignation = lookupDesignation;
		this.modifyDeliverman = modifyDeliverman;
		this.lookupDeliverman = lookupDeliverman;
		this.modifyCenter = modifyCenter;
		this.lookupCenter = lookupCenter;
		this.useDeliverSystem = useDeliverSystem;
	}

	public PermissionGroupEntity() {
	}

	@Id
	@Column(name = "id", nullable = false)
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	@Basic
	@Column(name = "group_name", nullable = false, length = 32)
	public String getGroupName() {
		return groupName;
	}

	public void setGroupName(String groupName) {
		this.groupName = groupName;
	}

	@Basic
	@Column(name = "admin", nullable = false)
	public boolean isAdmin() {
		return admin;
	}

	public void setAdmin(boolean admin) {
		this.admin = admin;
	}

	@Basic
	@Column(name = "modify_user", nullable = false)
	public boolean isModifyUser() {
		return modifyUser;
	}

	public void setModifyUser(boolean modifyUser) {
		this.modifyUser = modifyUser;
	}

	@Basic
	@Column(name = "lookup_user", nullable = false)
	public boolean isLookupUser() {
		return lookupUser;
	}

	public void setLookupUser(boolean lookupUser) {
		this.lookupUser = lookupUser;
	}

	@Basic
	@Column(name = "modify_department", nullable = false)
	public boolean isModifyDepartment() {
		return modifyDepartment;
	}

	public void setModifyDepartment(boolean modifyDepartment) {
		this.modifyDepartment = modifyDepartment;
	}

	@Basic
	@Column(name = "lookup_department", nullable = false)
	public boolean isLookupDepartment() {
		return lookupDepartment;
	}

	public void setLookupDepartment(boolean lookupDepartment) {
		this.lookupDepartment = lookupDepartment;
	}

	@Basic
	@Column(name = "modify_designation", nullable = false)
	public boolean isModifyDesignation() {
		return modifyDesignation;
	}

	public void setModifyDesignation(boolean modifyDesignation) {
		this.modifyDesignation = modifyDesignation;
	}

	@Basic
	@Column(name = "lookup_designation", nullable = false)
	public boolean isLookupDesignation() {
		return lookupDesignation;
	}

	public void setLookupDesignation(boolean lookupDesignation) {
		this.lookupDesignation = lookupDesignation;
	}

	@Basic
	@Column(name = "modify_deliverman", nullable = false)
	public boolean isModifyDeliverman() {
		return modifyDeliverman;
	}

	public void setModifyDeliverman(boolean modifyDeliverman) {
		this.modifyDeliverman = modifyDeliverman;
	}

	@Basic
	@Column(name = "lookup_deliverman", nullable = false)
	public boolean isLookupDeliverman() {
		return lookupDeliverman;
	}

	public void setLookupDeliverman(boolean lookupDeliverman) {
		this.lookupDeliverman = lookupDeliverman;
	}

	@Basic
	@Column(name = "modify_center", nullable = false)
	public boolean isModifyCenter() {
		return modifyCenter;
	}

	public void setModifyCenter(boolean modifyCenter) {
		this.modifyCenter = modifyCenter;
	}

	@Basic
	@Column(name = "lookup_center", nullable = false)
	public boolean isLookupCenter() {
		return lookupCenter;
	}

	public void setLookupCenter(boolean lookupCenter) {
		this.lookupCenter = lookupCenter;
	}

	@Basic
	@Column(name = "use_deliver_system", nullable = false)
	public boolean isUseDeliverSystem() {
		return useDeliverSystem;
	}

	public void setUseDeliverSystem(boolean useDeliverSystem) {
		this.useDeliverSystem = useDeliverSystem;
	}

	@Override
	public String toString() {
		return "Permission Group #" + id + "; name=" + groupName;
	}

	@Override
	public boolean equals(Object o) {
		if (this == o) return true;
		if (o == null || getClass() != o.getClass()) return false;
		PermissionGroupEntity that = (PermissionGroupEntity) o;
		return id == that.id &&
				admin == that.admin &&
				modifyUser == that.modifyUser &&
				lookupUser == that.lookupUser &&
				modifyDepartment == that.modifyDepartment &&
				lookupDepartment == that.lookupDepartment &&
				modifyDesignation == that.modifyDesignation &&
				lookupDesignation == that.lookupDesignation &&
				modifyDeliverman == that.modifyDeliverman &&
				lookupDeliverman == that.lookupDeliverman &&
				modifyCenter == that.modifyCenter &&
				lookupCenter == that.lookupCenter &&
				useDeliverSystem == that.useDeliverSystem &&
				Objects.equals(groupName, that.groupName);
	}

	@Override
	public int hashCode() {

		return Objects.hash(id, groupName, admin, modifyUser, lookupUser, modifyDepartment, lookupDepartment, modifyDesignation, lookupDesignation, modifyDeliverman, lookupDeliverman, modifyCenter, lookupCenter, useDeliverSystem);
	}
}
